package tr.richfacesext.components.captcha.validator;

import javax.faces.validator.Validator;
import javax.faces.webapp.ValidatorTag;
import javax.servlet.jsp.JspException;

/**
 * 
 * @author mert
 *
 */
@SuppressWarnings("serial")
public class CaptchaValidatorTag extends ValidatorTag {

	private String captchaId;
	
	private String valueRequiredMsg;
	
	private String textNotMatchMsg; 

	public CaptchaValidatorTag() {
		setValidatorId("captchaValidator");
	}

	public Validator createValidator() throws JspException {
		CaptchaValidator captchaValidator = (CaptchaValidator) super.createValidator();
		captchaValidator.setCaptchaId(captchaId);
		captchaValidator.setValueRequiredMsg(valueRequiredMsg);
		captchaValidator.setTextNotMatchMsg(textNotMatchMsg);
		
		return captchaValidator;
	}
	
	// Getters & setters
	
	public String getCaptchaId() {
		return captchaId;
	}

	public void setCaptchaId(String captchaId) {
		this.captchaId = captchaId;
	}

	public String getTextNotMatchMsg() {
		return textNotMatchMsg;
	}

	public void setTextNotMatchMsg(String textNotMatchMsg) {
		this.textNotMatchMsg = textNotMatchMsg;
	}

	public String getValueRequiredMsg() {
		return valueRequiredMsg;
	}

	public void setValueRequiredMsg(String valueRequiredMsg) {
		this.valueRequiredMsg = valueRequiredMsg;
	}
}